package com.googlecode.vmock.utils;

/**
 * Null-safe utility methods for Strings.
 * 
 * @author marcin.jagus
 */
public class ObjectUtils {

    /**
     * Constructor for subclassing.
     */
    protected ObjectUtils() {
    }

    /**
     * Checks if both objects are equal to each other.
     * <p>
     * Both objects are equal if they are both <code>null</code> or if <code>a.equals(b)</code> returns <code>true</code>.
     * 
     * @param a First object
     * @param b Second object
     * @return <code>true</code> if both objects are equal
     */
    public static boolean equals(Object a, Object b) {
        if (a == b) {
            return true;
        } else if (a == null || b == null) {
            return false;
        } else {
            return a.equals(b);
        }
    }
}
